package com.cloudcc.mobile.parser;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.cloudcc.mobile.util.Tools;
import com.litesuits.android.log.Log;

public class RenWuParse {

	/**
	 * 解析"带权限"插入返回数据
	 */
	public static boolean getResult(String jsonString) {
		boolean result = false;
		try {
			JSONObject obj = new JSONObject(jsonString);
			result = obj.getBoolean("result");
		} catch (JSONException e) {
			Tools.handle(e);
		}
		return result;
	}

	/**
	 * 解析修改返回数据
	 */
	public static boolean getUpResult(String jsonString) {
		Log.d("fanhuishuju2", "返回的数据" + jsonString);
		boolean result = false;
		try {
			JSONObject obj = new JSONObject(jsonString);
			result = obj.getBoolean("result");
		} catch (Exception e) {
			Tools.handle(e);
		}
		return result;
	}

	/**
	 * 解析修改返回数据
	 */
	public static String getEventId(String jsonString) {
		String result = "";
		try {
			JSONObject obj = new JSONObject(jsonString);
			JSONObject data = obj.getJSONObject("data");
			JSONArray ids = data.getJSONArray("ids");
			JSONObject id = ids.getJSONObject(0);
			result = id.getString("id");
		} catch (Exception e) {
			Tools.handle(e);
		}
		return result;
	}
}
